package cn.thoughtworks.school.services;

import cn.thoughtworks.school.feign.UserCenterFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

import static java.util.stream.Collectors.joining;

@Service
public class UserCenterService {
    @Autowired
    private UserCenterFeign userCenterFeign;

    public Map getUserInfo(Long userId) {
        return userCenterFeign.getUserById(userId);
    }

    public List<Map> getUsersByIds(List<Long> ids) {
        return userCenterFeign.getUsersByIds(ids.stream().map(String::valueOf).collect(joining(",")));
    }
}
